cmake_minimum_required(VERSION 3.0)
project(MRMDS_SERVER)

file(GLOB SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
add_library(server ${SRC_FILES})
target_include_directories(server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(server PUBLIC message)

add_executable(instance ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
target_link_libraries(instance PRIVATE server)

file(GLOB TEST_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
foreach(FILE ${TEST_FILES})
    get_filename_component(EXENAME ${FILE} NAME_WE)
    add_executable(${EXENAME} ${FILE})
    target_link_libraries(instance PRIVATE server)
endforeach()
